package com.zhanghu.backendZray.pojo.request.user;

import com.zhanghu.backendZray.valid.ValidPhone;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;

/**
 * @author ZhangDong
 * @date 2024/7/25 20:34
 */
@Data
public class UserRequest {

    @NotNull(message = "id不能为空", groups = {Update.class})
    private Integer id;

    @NotNull(message = "姓名不能为空", groups = {Create.class, Update.class})
    @Length(min = 1, max = 10, message = "姓名限定长度1-10")
    private String name;

    @NotNull(message = "手机号不能为空", groups = {Create.class, Update.class})
    @ValidPhone(groups = {Create.class, Update.class})
    private String phone;

    @NotNull(message = "密码不能为空", groups = {Create.class, Update.class})
    private String password;

    public interface Update {
    }

    ;

    public interface Create {
    }
}
